/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package utn.tsb.tej.world_logic;

import java.io.Serializable;

/**
 *
 * @author Administrador
 */
public class CardType implements Serializable{

    private int[] typeValues;
    private String typeName = "";
    public static final int EARTH = 1;
    public static final int WATER = 2;
    public static final int AIR = 3;
    public static final int JOKER = 4;

    public CardType(){
        typeValues=new int[1];
        typeName="";
    }

    public CardType(int[] typeValues) {
        this.typeValues = typeValues;
        for (int i = 0; i < typeValues.length; i++) {
            if (i != 0) {
                typeName += "\\";
            }
            switch (typeValues[i]) {
                case 1:
                    typeName += "Earth";
                    break;
                case 2:
                    typeName += "Water";
                    break;
                case 3:
                    typeName += "Air";
                    break;
                case 4:
                    typeName += "Joker";
                    break;
//                default:
//                    throw new Exception("The type value is NOT valid. Found: "
//                            + typeValues[i] + ". Must be between 1 and 4");

            }
        }

    }

    public int[] getTypeValues() {
        return typeValues;
    }

    public void setTypeValues(int[] typeValues) throws Exception {
        this.typeValues = typeValues;
        for (int i = 0; i < typeValues.length; i++) {
            if (i != 0) {
                typeName += "\\";
            }
            switch (typeValues[i]) {
                case 1:
                    typeName += "Earth";
                    break;
                case 2:
                    typeName += "Water";
                    break;
                case 3:
                    typeName += "Air";
                    break;
                case 4:
                    typeName += "Joker";
                    break;
                default:
                    throw new Exception("The type value is NOT valid. Found: "
                            + typeValues[i] + ". Must be between 1 and 4");

            }
        }
    }

    public String getTypeName() {
        return typeName;
    }
}
